package com.pjmike.netty.controller;

import com.pjmike.netty.client.NettyClient;
import com.pjmike.netty.entity.Users;
import com.pjmike.netty.server.http.web.annotation.*;
import com.pjmike.netty.server.http.web.rest.ResponseEntity;
import com.pjmike.netty.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


/**
* <p>
*  前端控制器
* </p>
*
* @author bigbomb
* @since 2021-01-13
*/

@RestController
@RequestMapping("/users")
public class UsersController {

    @Autowired
    private NettyClient nettyClient;
    @Autowired
    private UsersService usersService;

    @PostMapping("")
    @JsonResponse
    public  ResponseEntity<List> list(@RequestParam(value="name",required=true) String name) {
        System.out.println(name);
       List<Users> usersList = usersService.list();
       nettyClient.sendMsg("123123123123123","127.0.0.1",11884);
       return ResponseEntity.ok().build(usersList);
    }


}